package com.yanqu.road.entity.activity.doublespring.data;

import com.yanqu.road.entity.DataObject;
import com.yanqu.road.entity.DataStatus;
import com.yanqu.road.entity.FieldTypeAnnotation;

@FieldTypeAnnotation(tableName = "t_c_activity_double_spring_user_data", desc = "踏春游记-玩家数据表(出行玩家数据)")
public class DoubleSpringUserData extends DataObject {

    /**
     * 活动ID
     */
    private int activityId;
    
    /**
     * 玩家ID
     */
    private long userId;
    
    /**
     * 玩家区服ID
     */
    private long userServerId;
    
    /**
     * 伙伴ID
     */
    private long partnerUserId;
    
    /**
     * 伙伴区服ID
     */
    private long partnerUserServerId;
    
    /**
     * 我的分数
     */
    private long score;
    
    /**
     * 总分数
     */
    private long totalScore;
    
    /**
     * 创建时间
     */
    private long createTime;

    public void setActivityId(int activityId) {
        if (this.activityId != activityId) {
            this.activityId = activityId;
            setOp(DataStatus.Update);
        }
    }

    public int getActivityId() {
        return activityId;
    }

    public void setUserId(long userId) {
        if (this.userId != userId) {
            this.userId = userId;
            setOp(DataStatus.Update);
        }
    }

    public long getUserId() {
        return userId;
    }

    public void setUserServerId(long userServerId) {
        if (this.userServerId != userServerId) {
            this.userServerId = userServerId;
            setOp(DataStatus.Update);
        }
    }

    public long getUserServerId() {
        return userServerId;
    }

    public void setPartnerUserId(long partnerUserId) {
        if (this.partnerUserId != partnerUserId) {
            this.partnerUserId = partnerUserId;
            setOp(DataStatus.Update);
        }
    }

    public long getPartnerUserId() {
        return partnerUserId;
    }

    public void setPartnerUserServerId(long partnerUserServerId) {
        if (this.partnerUserServerId != partnerUserServerId) {
            this.partnerUserServerId = partnerUserServerId;
            setOp(DataStatus.Update);
        }
    }

    public long getPartnerUserServerId() {
        return partnerUserServerId;
    }

    public void setScore(long score) {
        if (this.score != score) {
            this.score = score;
            setOp(DataStatus.Update);
        }
    }

    public long getScore() {
        return score;
    }

    public void setTotalScore(long totalScore) {
        if (this.totalScore != totalScore) {
            this.totalScore = totalScore;
            setOp(DataStatus.Update);
        }
    }

    public long getTotalScore() {
        return totalScore;
    }

    public void setCreateTime(long createTime) {
        if (this.createTime != createTime) {
            this.createTime = createTime;
            setOp(DataStatus.Update);
        }
    }

    public long getCreateTime() {
        return createTime;
    }

    /**
     * 添加积分
     * @param score 积分值
     * @param selfFlag 是否为自己的积分
     */
    public synchronized void addScore(long score, boolean selfFlag) {
        if (selfFlag) {
            this.setScore(this.getScore() + score);//自己的积分
        }
        this.setTotalScore(this.getTotalScore() + score);//总积分
    }
}
